<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>印章效果示例</title>
    <style>
        body {
            margin: 0;
            padding: 20px;
            font-family: Arial, sans-serif;
            background: #f5f5f5;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
        }

        .document {
            position: relative;
            padding: 30px;
            border: 1px solid #ddd;
            margin: 20px 0;
            min-height: 200px;
        }

        /* 印章样式 */
        .stamp {
            position: absolute;
            right: 50px;
            bottom: 50px;
            width: 120px;
            height: 120px;
            display: flex;
            align-items: center;
            justify-content: center;
            transform: rotate(-15deg);
            opacity: 0.9;
        }

        .stamp-inner {
            position: relative;
            width: 100%;
            height: 100%;
        }

        .stamp-circle {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: 3px solid #c41010;
            border-radius: 50%;
            box-shadow: inset 0 0 8px rgba(196, 16, 16, 0.2);
        }

        /* 外圈文字 */
        .stamp-text {
            position: absolute;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #c41010;
            font-size: 24px;
            font-weight: bold;
            white-space: nowrap;
            text-shadow: 0 0 1px rgba(196, 16, 16, 0.3);
            font-family: "SimSun", serif;
        }

        /* 控制面板 */
        .controls {
            margin-top: 20px;
            padding: 15px;
            background: #f5f7fa;
            border-radius: 4px;
        }

        .control-group {
            margin-bottom: 10px;
        }

        label {
            display: block;
            margin-bottom: 5px;
            color: #606266;
            font-size: 14px;
        }

        input[type="range"] {
            width: 100%;
            margin: 5px 0;
        }

        button {
            padding: 8px 15px;
            border: 1px solid #dcdfe6;
            background: white;
            cursor: pointer;
            border-radius: 4px;
            transition: all 0.3s;
            margin-right: 10px;
        }

        button:hover {
            color: #409eff;
            border-color: #c6e2ff;
            background-color: #ecf5ff;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>印章效果示例</h2>
        
        <!-- 文档区域 -->
        <div class="document" id="document">
            <h3>示例文档</h3>
            <p>这是一份需要盖章的示例文档内容...</p>
            <p>可以通过下方控制面板调整印章的样式和位置。</p>
            
            <!-- 印章 -->
            <div class="stamp" id="stamp">
                <div class="stamp-inner">
                    <div class="stamp-circle"></div>
                    <div class="stamp-text">审核通过</div>
                </div>
            </div>
        </div>

        <!-- 控制面板 -->
        <div class="controls">
            <div class="control-group">
                <label>旋转角度: <span id="rotateValue">-15°</span></label>
                <input type="range" min="-180" max="180" value="-15" id="rotateControl">
            </div>
            <div class="control-group">
                <label>透明度: <span id="opacityValue">0.8</span></label>
                <input type="range" min="0" max="100" value="80" id="opacityControl">
            </div>
            <div class="control-group">
                <label>大小: <span id="sizeValue">120px</span></label>
                <input type="range" min="60" max="200" value="120" id="sizeControl">
            </div>
            <div class="control-group">
                <button onclick="randomizePosition()">随机位置</button>
                <button onclick="resetStamp()">重置</button>
            </div>
        </div>
    </div>

    <script>
        const stamp = document.getElementById('stamp');
        const rotateControl = document.getElementById('rotateControl');
        const opacityControl = document.getElementById('opacityControl');
        const sizeControl = document.getElementById('sizeControl');
        const document_area = document.getElementById('document');

        // 更新印章样式
        function updateStamp() {
            const rotate = rotateControl.value;
            const opacity = opacityControl.value / 100;
            const size = sizeControl.value;

            stamp.style.transform = `rotate(${rotate}deg)`;
            stamp.style.opacity = opacity;
            stamp.style.width = `${size}px`;
            stamp.style.height = `${size}px`;

            // 更新显示值
            document.getElementById('rotateValue').textContent = `${rotate}°`;
            document.getElementById('opacityValue').textContent = opacity;
            document.getElementById('sizeValue').textContent = `${size}px`;
        }

        // 随机位置
        function randomizePosition() {
            const maxX = document_area.offsetWidth - stamp.offsetWidth - 40;
            const maxY = document_area.offsetHeight - stamp.offsetHeight - 40;
            
            const randomX = Math.max(20, Math.random() * maxX);
            const randomY = Math.max(20, Math.random() * maxY);

            stamp.style.right = 'auto';
            stamp.style.bottom = 'auto';
            stamp.style.left = `${randomX}px`;
            stamp.style.top = `${randomY}px`;
        }

        // 重置印章
        function resetStamp() {
            rotateControl.value = -15;
            opacityControl.value = 80;
            sizeControl.value = 120;
            
            stamp.style.right = '50px';
            stamp.style.bottom = '50px';
            stamp.style.left = 'auto';
            stamp.style.top = 'auto';
            
            updateStamp();
        }

        // 添加事件监听
        rotateControl.addEventListener('input', updateStamp);
        opacityControl.addEventListener('input', updateStamp);
        sizeControl.addEventListener('input', updateStamp);

        // 初始化
        updateStamp();
    </script>
</body>
</html> 